True when no wall, and no door that is not open, is between the two places: a line of sight. Use it to decide whether an enemy can see you.
Game Boy: not available
Game Boy Color: not available
On other consoles this differs: see Side by side and How the consoles differ.
view3d_line_clear(x1, y1, x2, y2) -> bool| Name | Type |
|---|---|
x1 | real |
y1 | real |
x2 | real |
y2 | real |
bool
True when no wall, and no door that is not open, stands between the two room places (room pixels counted from the room's top-left corner): a line of sight. Use it to decide whether an enemy can see you before it fires, or whether a thing can be picked up through a window.
It walks the map tile by tile like a ray, so a long line costs about as much as drawing one screen column. A door counts as open once it is open enough to walk through. Things do not block it.
// does the enemy see the camera?
if (view3d_line_clear(x, y, view3d_x(), view3d_y())) {
x += 0.5;
}The enemy only advances while it can see the camera.
It walks the map tile by tile like a ray, so a long line costs about as much as drawing one screen column. A door counts as open once it is open enough for the camera to walk through. Things do not block it.